#pragma once
#ifndef __G_MUTEX_H__
#define __G_MUTEX_H__


#include <string>

#include "GSynchronizer.h"
#include "GTypes.h"

namespace GThread
{

	class GMutex : public GWaitable
	{
	protected:
		void*			Mutex;

		std::string		Name;

	public:
						GMutex();
						~GMutex();
		
		void*			GetHandle() const;

		const char*		GetName() const;

		bool			IsCreated() const;

		bool			Create(bool StartAcquired, const char* Name);
		void			Release();

		GWaitResult		Acquire(GUInt32 TimeOut = G_TIMEOUT_INFINITE);
		bool			Free();
	
	};
}

#endif